function [scan_info] = parse_colibri_scaninfo(data_path, header)
% this function selects and parses the colibri output txt file. the text
% file closest in time to the first frame acquisition time is chosen.


txt_files=dir([data_path '*.txt']);

time_p=strfind(header(1).ImageDescription,'time');
t_rec=header(1).ImageDescription(time_p+6:time_p+24);

for ind=1:length(txt_files)
    delta_t(ind)=datenum(txt_files(ind).name(1:end-4),'yyyy-mm-dd_HH-MM-SS') - datenum([t_rec(1:10) '_' t_rec(12:13) '-' t_rec(15:16) '-' t_rec(18:19)],'yyyy-mm-dd_HH-MM-SS');
end

[not_used,this_file_ind]=min(abs(delta_t));

fid = fopen([data_path txt_files(this_file_ind).name]);
scan_info = textscan(fid,'%[^\t]%[^\n]');
fclose(fid);







